package com.mebs.edi.model.edi.e211;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.mebs.edi.model.dom.DomAttribute;
import com.mebs.edi.model.dom.DomEntity;

/**
 * 
 * GN subsection of NN section in a 211 EDI file 
 * 
 * @author nit
 *
 */
@Entity()
@Table(name = "edi_211_gn")
@DomEntity(name = "G61")
public class Edi211Gn {
	
	@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "Id")
	private Long id;
	
	@Column(nullable = true, length = 2)
	@DomAttribute
	private String g6101; // Contact function code
	
	@Column(nullable = true, length = 60)
	@DomAttribute
	private String g6102; // Name
	
	@Column(nullable = true, length = 2)
	@DomAttribute
	private String g6103; // Communication Number Qualifier
	
	@Column(nullable = true, length = 80)
	@DomAttribute
	private String g6104; // Communication Number
	
	@Column(nullable = true, length = 60)
	@DomAttribute
	private String g6105; // Contact Inquiry Reference
	
	public Edi211Gn() {
		super();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getG6101() {
		return g6101;
	}

	public void setG6101(String g6101) {
		this.g6101 = g6101;
	}

	public String getG6102() {
		return g6102;
	}

	public void setG6102(String g6102) {
		this.g6102 = g6102;
	}

	public String getG6103() {
		return g6103;
	}

	public void setG6103(String g6103) {
		this.g6103 = g6103;
	}

	public String getG6104() {
		return g6104;
	}

	public void setG6104(String g6104) {
		this.g6104 = g6104;
	}

	public String getG6105() {
		return g6105;
	}

	public void setG6105(String g6105) {
		this.g6105 = g6105;
	}

	@Override
	public String toString() {
		return "Edi211Gn [id=" + id + ", g6101=" + g6101 + ", g6102=" + g6102 + ", g6103=" + g6103
				+ ", g6104=" + g6104 + ", g6105=" + g6105 + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((g6101 == null) ? 0 : g6101.hashCode());
		result = prime * result + ((g6102 == null) ? 0 : g6102.hashCode());
		result = prime * result + ((g6103 == null) ? 0 : g6103.hashCode());
		result = prime * result + ((g6104 == null) ? 0 : g6104.hashCode());
		result = prime * result + ((g6105 == null) ? 0 : g6105.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Edi211Gn other = (Edi211Gn) obj;
		if (g6101 == null) {
			if (other.g6101 != null)
				return false;
		} else if (!g6101.equals(other.g6101))
			return false;
		if (g6102 == null) {
			if (other.g6102 != null)
				return false;
		} else if (!g6102.equals(other.g6102))
			return false;
		if (g6103 == null) {
			if (other.g6103 != null)
				return false;
		} else if (!g6103.equals(other.g6103))
			return false;
		if (g6104 == null) {
			if (other.g6104 != null)
				return false;
		} else if (!g6104.equals(other.g6104))
			return false;
		if (g6105 == null) {
			if (other.g6105 != null)
				return false;
		} else if (!g6105.equals(other.g6105))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}	
}
